home *** CD-ROM | disk | FTP | other *** search
-
- SHMAT(2) UNIX Programmer's Manual SHMAT(2)
-
- NNAAMMEE
- sshhmmaatt, sshhmmddtt - map/unmap shared memory
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<ssyyss//iippcc..hh>>
- ##iinncclluuddee <<ssyyss//sshhmm..hh>>
-
- _v_o_i_d _*
- sshhmmaatt(_i_n_t _s_h_m_i_d, _v_o_i_d _*_s_h_m_a_d_d_r, _i_n_t _s_h_m_f_l_g)
-
- _i_n_t
- sshhmmddtt(_v_o_i_d _*_s_h_m_a_d_d_r)
-
- DDEESSCCRRIIPPTTIIOONN
- sshhmmaatt() maps the shared memory segment associated with the shared memory
- identifier _s_h_m_i_d into the address space of the calling process. The ad-
- dress at which the segment is mapped is determined by the _s_h_m_a_d_d_r parame-
- ter. If it is equal to 0, the system will pick an address itself. Other-
- wise, an attempt is made to map the shared memory segment at the address
- _s_h_m_a_d_d_r specifies. If SHM_RND is set in _s_h_m_f_l_g, the system will round the
- address down to a multiple of SHMLBA bytes (SHMLBA is defined in
- <_s_y_s_/_s_h_m_._h> ).
-
- A shared memory segment can be mapped read-only by specifying the
- SHM_RDONLY flag in _s_h_m_f_l_g.
-
- sshhmmddtt() unmaps the shared memory segment that is currently mapped at
- _s_h_m_a_d_d_r from the calling process' address space. _s_h_m_a_d_d_r must be a value
- returned by a prior sshhmmaatt() call. A shared memory segment will remain ex-
- istant until it is removed by a call to shmctl(2) with the IPC_RMID com-
- mand.
-
- RREETTUURRNN VVAALLUUEESS
- sshhmmaatt() returns the address at which the shared memory segment has been
- mapped into the calling process' address space when successful, sshhmmddtt()
- returns 0 on successful completion. Otherwise, a value of -1 is returned,
- and the global variable _e_r_r_n_o is set to indicate the error.
-
- EERRRROORRSS
- sshhmmaatt() will fail if:
-
- [EACCESS] The calling process has no permission to access this shared
- memory segment.
-
- [ENOMEM] There is not enough available data space for the calling
- process to map the shared memory segment.
-
- [EINVAL] _s_h_m_i_d is not a valid shared memory identifier.
-
- _s_h_m_a_d_d_r specifies an illegal address.
-
- [EMFILE] The number of shared memory segments has reached the sys-
- tem-wide limit.
-
- sshhmmddtt() will fail if:
-
- [EINVAL] _s_h_m_a_d_d_r is not the start address of a mapped shared memory
- segment.
-
- SSEEEE AALLSSOO
- shmctl(2), shmget(2), mmap(2)
-
-